package com.common.converter;

import com.common.entity.casemanage.CaseEntity;
import com.common.entity.target.TargetTypeEntity;
import com.common.excel.excelinfo.CaseExcelInfo;
import com.common.requestvo.casemanage.CaseReqVo;
import com.common.requestvo.target.TargetTypeReqVo;
import com.common.vo.casemanage.CaseVo;
import com.common.vo.target.TargetTypeVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author johnny
 * @create 2020-07-13 下午5:04
 **/
@Mapper
public interface CaseConverter {

    CaseConverter INSTANCE = Mappers.getMapper(CaseConverter.class);


    @Mappings({
            @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "caseAcceptDate", target = "caseAcceptDate", dateFormat = "yyyy-MM-dd"),
            @Mapping(source = "caseExpireDate", target = "caseExpireDate", dateFormat = "yyyy-MM-dd"),
            @Mapping(source = "caseFinishDate", target = "caseFinishDate", dateFormat = "yyyy-MM-dd"),
            @Mapping(source = "caseEndDate", target = "caseEndDate", dateFormat = "yyyy-MM-dd"),
            @Mapping(source = "caseHandleDate", target = "caseHandleDate", dateFormat = "yyyy-MM-dd"),
    })
    CaseVo domain2vo(CaseEntity caseEntity);


    @Mappings({
            @Mapping(source = "caseAcceptDate", target = "caseAcceptDate", dateFormat = "yyyy/MM/dd"),
            @Mapping(source = "caseExpireDate", target = "caseExpireDate", dateFormat = "yyyy/MM/dd"),
            @Mapping(source = "caseFinishDate", target = "caseFinishDate", dateFormat = "yyyy/MM/dd"),
            @Mapping(source = "caseEndDate", target = "caseEndDate", dateFormat = "yyyy/MM/dd"),
    })
    CaseEntity excel2domain(CaseExcelInfo caseExcelInfo);
}